package wj.tree;

import wj.WJValue;

public class DropNode implements WJNode {

	private WJNode expressionNode;
	private WJNode stringNode;
	
	public DropNode(WJNode expressionNode, WJNode stringNode){
		this.expressionNode = expressionNode;
		this.stringNode = stringNode;
	}
	
	@Override
	public WJValue evaluate() {
		
		int n = expressionNode.evaluate().toInt();
		String string = stringNode.evaluate().toString();
		
		return new WJValue(string.substring(n, string.length()));
	}

}
